<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Dashboard Template for Bootstrap</title>
    <!-- 小图标 -->
    <link rel="shortcut icon" th:href="@{/resources/favicon.ico}"/>
    <link rel="bookmark" th:href="@{/resources/favicon.ico}"/>

    <!-- Bootstrap core CSS -->
    <link href="/webjars/bootstrap/4.3.1/css/bootstrap.css" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link th:href="@{/asserts/css/dashboard.css}" rel="stylesheet">
    <style type="text/css">
        /* Chart.js */

        @-webkit-keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        @keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        .chartjs-render-monitor {
            -webkit-animation: chartjs-render-animation 0.001s;
            animation: chartjs-render-animation 0.001s;
        }
    </style>
</head>

<body>
<!-- 引入顶部栏 -->
<div th:replace="commons/bar::topbar"></div>

<div class="container-fluid">
    <div class="row">
        <!-- 引入侧边栏 -->
        <div th:replace="commons/bar::#sidebar(activeUri='users')"></div>

        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <h2 th:text="${user != null} ? '学校管理员修改' : '学校管理员添加'">学校管理员添加</h2>
            <hr>
            <input type="hidden" name="uinfo.fSchool" th:value="${schoolId}">
            <input type="hidden" name="pUid" th:if="${user != null}" th:value="${user.pUid}">
            <div class="form-group">
                <label>Name</label>
                <input name="name" type="text" class="form-control" placeholder="name,can login and show."
                       th:value="${user != null} ? ${user.name}">
            </div>
            <div class="form-group">
                <label>Password</label><br/>
                <label><font color="red">注意：如果修改密码项，即是重置密码！</font></label><br/>
                <input name="pwd" type="text" class="form-control" placeholder="password,can login.">
            </div>
            <div class="form-group">
                <label>Position</label>
                <input name="uInfo.position" type="text" class="form-control" placeholder="position."
                       th:value="${user != null} ? ${user.uinfo.position}">
            </div>
            <div class="form-group">
                <label>Phone</label>
                <input name="uInfo.phone" type="text" class="form-control" placeholder="constant phone."
                       th:value="${user != null} ? ${user.uinfo.phone}">
            </div>

            <button type="submit" class="btn btn-primary" onclick="return userSaveOrUpdate($('#user_source').val(), $('#token').val())"
                    th:text="${user != null} ? '修改' : '添加'">添加</button>


        </main>
        <form id="deleteEmpForm" method="post">
            <input type="hidden" name="_method" value="delete">
        </form>
    </div>
</div>

<!-- 引入公共的js  -->
<div th:replace="commons/js::js"></div>
<!-- 自定义的js -->
<script type="text/javascript" th:src="@{/asserts/js/commons.js}" ></script>
<script type="text/javascript" th:src="@{/asserts/js/user.js}" ></script>

</body>
</html>